﻿/********************************************
* 公司名称：snailInfo
* 创 建 人：cfhknight
* 创建日期：2025/9/29 14:36:40
* 说    明：convert to bool static function
* 版    本：V0.0.0.1
********************************************/
namespace SnailInfo.ConvertExtension
{
    public static class BooleanExtension
    {
        /// <summary>
        /// convert string value to bool
        /// </summary>
        /// <param name="value"></param>
        /// <remarks>
        /// true yes ok good y success successed convert to true , else convert to false
        /// </remarks>
        /// <returns></returns>
        public static bool ToBoolean(this string value)
        {
            switch (value.Trim().ToLower()) {
                case "true":
                case "yes":
                case "ok":
                case "1":
                case "good":
                case "y":
                case "success":
                case "successed":
                    return true;
                default:
                    return false;

            }
        }
    }
}
